/* Copyright (C) 2015-2016 HangZhou Zenzet Technology Co., Ltd.
 * All right reserved

 * File:crypto/locketdigest.h
 * Author:guojianchuan/max
 * Date:2016-06-07

 */

#ifndef _LOCKET_DIGEST_H_
#define _LOCKET_DIGEST_H_

#ifdef __cplusplus
extern "C" {
#endif


/* Declare : Macro/Struct/Enum/Union */
#define MD5_LEN          32
#define MD5_HEX_LEN      (MD5_LEN + 1)
#define MD5_BASE64_LEN   (MD5_LEN * 2)
#define SHA1_LEN         40
#define SHA1_HEX_LEN     (SHA1_LEN + 1)
#define SHA1_BASE64_LEN  (SHA1_LEN * 2)

/**
* @struct: CIPHER_HASH_S
* @Author: guojianchuan/max
* @Date: 2016-06-02
* @Description: HASH结构
*/
typedef struct tagHash
{
    /* 算法名称 MD5/SHA1/SHA256/SHA512 */
    char szAlgoName[64];

    /* 输入 */
    unsigned char *pucInput;

    /* 输入长度 */
    int iInputLen;

    /* 输入编码格式 hex:0 base64:1 binary:2 */
    int iInputEncode;

    /* 输出 */
    unsigned char *pucOutput;

    /* 输出长度 */
    int iOutputLen;

    /* 输出编码格式 hex:0 base64:1 binary:2  */
    int iOutputEncode;
}CIPHER_HASH_S;

/* Declare: Function */
int LOCKET_CIPHER_Digest(INOUT CIPHER_HASH_S *pstHash);

#ifdef __cplusplus
}
#endif

#endif  /* _LOCKET_DIGEST_H_ */
